<template>
  <div class="admin">
      <p>{{user}},欢迎登录！</p>
      <p @click="handleToBack">退出</p>
  </div>
</template>

<script>
export default {
    data(){
        return {
            user: ''
        }
    },
    methods: {
        handleToBack(){
            localStorage.removeItem('name')
            this.$router.push('/login')
        }
    },
    mounted(){
        this.user = localStorage.getItem('name')
    }
}
</script>

<style>
.admin{
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: space-between;
}
</style>